From 03f7e9ab3fc71b26a65214643fe68170032de5da Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 12 Sep 2005 00:58:08 +0000 Subject: [PATCH] code simplification --- ChangeLog | 4 +++ tests/conversions.c | 65 +++++++++++++-------------------------------- 2 files changed, 23 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fd7368..14e1646 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-12 Øyvind Kolås + + * tests/conversions.c: (test_init): code simplification. + 2005-09-12 Øyvind Kolås * babl/babl-classes.h: add loss field to format class. diff --git a/tests/conversions.c b/tests/conversions.c index c2abf1b..b0474d8 100644 --- a/tests/conversions.c +++ b/tests/conversions.c @@ -14,59 +14,21 @@ int OK=1; double test[pixels * 4]; -double r_interval (double min, double max) +static void +test_init (void) { - long int rand_i = random (); - double ret; - ret = (double) rand_i / RAND_MAX; - ret*=(max-min); - ret+=min; - return ret; -} + int i; -void test_init (void) -{ - double r_min = 0.0, - r_max = 1.0, - g_min = 0.0, - g_max = 1.0, - b_min = 0.0, - b_max = 1.0, - a_min = 0.0, - a_max = 1.0; - int i; - double r,g,b,a; - for (i=0;isource); - Babl *fmt_destination = BABL(conversion->destination); + Babl *fmt_rgba_double; + Babl *fmt_source; + Babl *fmt_destination; double error=0.0; @@ -76,6 +38,17 @@ validate_conversion (BablConversion *conversion) void *ref_destination; double *ref_destination_rgba_double; + fmt_rgba_double = babl_format_new ( + babl_model ("RGBA"), + babl_type ("double"), + babl_component ("R"), + babl_component ("G"), + babl_component ("B"), + babl_component ("A"), + NULL); + fmt_source = BABL(conversion->source); + fmt_destination = BABL(conversion->destination); + source = babl_calloc (pixels, fmt_source->format.bytes_per_pixel); destination = babl_calloc (pixels, fmt_destination->format.bytes_per_pixel); ref_destination = babl_calloc (pixels, fmt_destination->format.bytes_per_pixel); -- 2.30.2